# -*- coding : utf-8 -*-

def index():
    message = '用户 ' + str(session.user_name) + '！！！'

    return dict(
        message = message
        )

def logout():
    del_ok = ''
    message = None
    try:
        # 设置 del_ok 默认值
        del_ok = request.args[0]
    except:
        pass
    
    x = ['session.%s' % i for i in session.keys()]
        
    if del_ok == 'yes':
        for i in x:
            try:
                exec('del %s') % i
            except NameError:
                pass
        redirect(APPLICATION)
    elif del_ok == 'no':
        redirect(APPLICATION)
    
    return dict(
        message = message,
        )
    

def fail():
    return dict()


# # uncomment the following if you have defined "auth" and "crud" in models
def user(): return dict(form=auth())
def data(): return dict(form=crud())
def download(): return response.download(request,db)
# # tip: use @auth.requires_login, requires_membership, requires_permission
